import com.beans.User;
import com.beans.UserController2;
import com.beans.UserController3;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.beans.Introspector;

// 关于bean id的命名 为什么是小驼峰结构
public class APP2 {
    public static void main1(String[] args) {
        String str = "UserController";
        String str2 = "APIController";
        System.out.println(Introspector.decapitalize(str));
        System.out.println(Introspector.decapitalize(str2));
        //打印结果
        //userController
        //APIController
    }


    public static void main2(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        User user = context.getBean("getUser",User.class);
        System.out.println(user);
        //User{id=1, name='zhans'}
    }



    public static void main3(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        User user = context.getBean("userInfo", User.class);
        System.out.println(user);
        // User{id=2, name='lisi'}
    }


    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        UserController2 userController2 = context.getBean("userController2",UserController2.class);
        userController2.sayHi();
        //hello UserService

        UserController3 userController3 = context.getBean("userController3",UserController3.class);
        userController3.sayHi();
        //hello UserService
    }
}
